package org.jinghouyu.json.core;

import org.jinghouyu.json.utils.IdentitySet;

/**
 * @author jinghouyu
 *
 */
public class JsonContext {

	private StringBuilder context = new StringBuilder();
	private IdentitySet<Object> objectContext = new IdentitySet<Object>();
	private static final String NULL = "null";
	
	public JsonContext() {}
	
	public JsonContext contextNull() {
		context.append(NULL);
		return this;
	}
	
	public JsonContext context(String string) {
		context.append(string);
		return this;
	}
	
	public JsonContext context(char c) {
		context.append(c);
		return this;
	}
	
	public JsonContext context(Number number) {
		context.append(number);
		return this;
	}
	
	public JsonContext context(char[] chars, int start, int end) {
		context.append(chars, start, end);
		return this;
	}
	
	public IdentitySet<Object> getObjectContext() {
		return objectContext;
	}
	
	public String toString() {
		return context.toString();
	}
}
